package org.hot100_1;

public class leetcode5 {
    public int maxArea(int[] height){
        int left =0;
        int right = height.length-1;

        int res = Integer.MIN_VALUE;
        while (left<right){
            int area=(right-left)*Math.min(height[left],height[right]);
            res = Math.max(res,area);
            if (height[left]<height[right]){
                left++;
            }else {
                right--;
            }
        }

        return res;
    }
}
